package com.mind.adjust.utils.jsonpath.serilaizer;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONReader;
import com.jayway.jsonpath.JsonPath;

/**
 * @author Wzm
 */
public class JsonPathSerializer<T> implements JsonSerializer<T> {

    private final Class<T> clazz;


    public JsonPathSerializer(Class<T> clazz)
    {
        super();
        this.clazz = clazz;
    }

    @Override
    public T get(String jsonStr, String key)  {
            return  JsonPath
                    .parse(jsonStr)
                    .read(key, clazz);
    }
}
